# def add(a,b):
#     return a+b
# def dele(a,b):
#     return a-b
# def mul(a,b):
#     return a*b
# def div(a,b):
#     return a/b
# def menu():
#     print('==========菜单==========')
#     print('=====1.加      2.减=====')
#     print('=====3.乘      4.除=====')
#     print('=====5.退出        =====')
#     print('==========菜单==========')
# while True:
#     a = (int)(input('请输入第一个数字->'))
#     b = (int)(input('请输入第一个数字->'))
#     menu()
#     num = (int)(input('请输入你要执行的操作->'))
#     if num==1:
#         print(add(a,b))
#     elif num==2:
#         print(dele(a,b))
#     elif num==3:
#         print(mul(a,b))
#     elif num==4:
#         print(div(a,b))
#     elif num==5:
#         print('退出系统...')
#         break
#     else:
#         print('输入有误，请重新输入...')


student_list = [{'name':'cxd','sex':'male','phone':'123456'}]
def add():
    while True:
        name = input('请输入学生姓名->')
        sex = input('请输入学生性别->')
        phone = input('请输入学生电话->')
        student = {'name':name,'sex':sex,'phone':phone}
        student_list.append(student)
        answer = input('是否继续添加？->yes/no')
        if answer == 'yes':
            continue
        else:
            break

def show():
    name = input("请输入查找的姓名->")
    for student in student_list:
        if student['name'] == name:
            print(student)
            return
    print("查无此人")

def update():
    name = input("请输入姓名")
    for student in student_list:
        if student['name'] == name:
            student['name'] = input("请输入修改后的名字")
            student['sex'] = input("请输入修改后的性别")
            student['phone'] = input("请输入修改后的电话")
            print(student)
            return
    print("修改失败")
def remove():
    name = input("请输入删除的姓名")
    for student in student_list:
        if student['name'] == name:
            print(student)
            student_list.remove(student)
            print("已成功删除")
            return
    print("删除失败")
def menu():
    print('==========学生信息系统==========')
    print('=====1.添加信息   2.删除信息=====')
    print('=====3.修改信息   4.查找信息=====')
    print('=====5.显示所有   6.退出系统=====')
    print('==========学生信息系统==========')
while True:
    menu()
    num = (int)(input('请输入你的选择->'))
    if num==1:
        add()
    elif num==2:
        remove()
    elif num==3:
        update()
    elif num==4:
        show()
    elif num==5:
        print(student_list)
    elif num==6:
        print("你已退出系统...")
        break
    else:
        print("输入有误，请重新选择...")